package pl.pr3sto.auctions

import pl.pr3sto.enums.AuctionType;
import pl.pr3sto.enums.ShippingType;
import pl.pr3sto.security.Profile

class Auction {

	AuctionType auctionType = AuctionType.AUCTION
	Integer startingPrice
	Integer minimumPrice
	Integer buyNowPrice
	Integer itemsCount = 1
	Date finishDate
	ShippingType shippingType
	Integer shippingCost
	Integer viewsCount = 0
	String description
	
	
	static belongsTo = [seller: Profile, category: Category]
	static hasMany = [offers: Offer]
	
    static constraints = {
		minimumPrice(nullable: true)
		buyNowPrice(nullable: true)
    }
	
	static mapping = {
		description(type: 'text')
	}
}
